package com.bms.cfcmms.model.system.module;

import com.bms.cfcmms.util.annotation.TableDefine;
import com.bms.cfcmms.model.BaseModel;
import com.bms.cfcmms.util.annotation.FieldDefine;
import lombok.Data;

import java.io.Serializable;

import javax.persistence.Column;

/**
 * Created by carl on 2016/4/11.
 */
@Data
@TableDefine(group = "系统模块", id = 9901, primaryKey = "moduleId", title = "系统模块")
public class Module extends BaseModel implements Serializable {

    public static final String PRIMARY_KEY = "moduleId";
    public static final String TABLE_NAME = "module";

    @FieldDefine(title = "模块ID号", number = 10)
    @Column(nullable = false, length = 10)
    private Long moduleId; // 模块ＩＤ，模块序号

    @FieldDefine(title = "模块标识", number = 30)
    @Column(nullable = false, length = 50, updatable = false)
    private String moduleName; // 模块英文名称

    @FieldDefine(title = "显示标志字段", number = 81)
    @Column(nullable = false, length = 50)
    // 模块主要关键内容的字段，如合同的是合同名称，部门的是部门名称
    private String nameFields;

    @FieldDefine(title = "是否等于", number = 801)
    @Column(nullable = true, length = 1024)
    private String moduleEquals;

    @FieldDefine(title = "模块名称", nameField = true, number = 40)
    @Column(nullable = false, length = 50)
    private String title; // 模块中文名称

    @FieldDefine(title = "表名称", number = 50)
    @Column(nullable = false, length = 50)
    private String tableName;

    @FieldDefine(title = "主键", number = 80)
    @Column(nullable = false, length = 50)
    private String primaryKey;// 模块主键
    private String parentKey;

    @FieldDefine(title = "请求地址", number = 110)
    @Column(nullable = false, length = 50)
    private String requestMapping;// 系统中后台服务的调用接入点 user.do,employee.do 等
    private String iconCls;

    @FieldDefine(title = "可用", number = 160)
    @Column(nullable = false)
    private Boolean isEnable = false;

    @FieldDefine(title = "可浏览", number = 170)
    @Column(nullable = false)
    private Boolean hasBrowse = false;

    @FieldDefine(title = "可增加", number = 180)
    @Column(nullable = false)
    private Boolean hasInsert = false;

    @FieldDefine(title = "可修改", number = 190)
    @Column(nullable = false)
    private Boolean hasEdit = false;

    @FieldDefine(title = "可删除", number = 200)
    @Column(nullable = false)
    private Boolean hasDelete = false;

    @FieldDefine(title = "可权限设置", remark = "用户可对此模块设置权限，选定的才可以浏览与操作", number = 260)
    @Column(nullable = false)
    private Boolean canLimit = false; // 此模块是否能进行权限设置

    @FieldDefine(title = "Excel导入", remark = "是否可以通过Excel导入新增记录", number = 270)
    @Column(nullable = false)
    private Boolean allowInsertExcel = false;

    @FieldDefine(title = "Excel修改", remark = "是否可以导出的Excel修改后再导入", number = 280)
    @Column(nullable = false)
    private Boolean allowEditExcel = false;

    @FieldDefine(title = "可图表", number = 290)
    @Column(nullable = false)
    private Boolean hasChart = false;

    @FieldDefine(title = "系统模块", number = 300, remark = "如果是系统模块，用户没有浏览权限，就不把模块定义发送到前端")
    @Column(nullable = false)
    private Boolean isSystem = false;

    @FieldDefine(title = "备注", number = 800)
    private String remark;

    private String tableAsName;

}
